package org.wattdepot.cli.command;

/**
 * Prints a help message specifying all legal commands.
 * 
 * @author Alex Kan and Kelvin Green
 * @version 2.0
 */
public class WattDepotHelpCommand extends WattDepotCommand {
  /**
   * Prints a help message specifying all legal commands.
   * 
   * @param args contains an array of strings created from the user input.
   * @return a string variable named output containing all the output for the method.
   */
  @Override
  public String doCommand(String args[]) {
    if (args.length != 1) { // Checks for correct input.
      return "Correct command is help";
    }
    return help();
  }

  /**
   * help Creates a String of all the help commands.
   * 
   * @return a string variable named output containing all the output for the method.
   */
  private String help() {
    String output = "";
    output += "help" + cr;
    output += "  This message" + cr;
    output += "quit" + cr;
    output += "  Exits the system" + cr;
    output += "sources" + cr;
    output += "  Prints a table summarizing the public sources in the system, one per line." + cr;
    output += "source {source} summary" + cr;
    output += "  Prints information about a single source." + cr;
    output += "sensordata {source} timestamp {timestamp}" + cr;
    output += "  Prints information about a single sensor data instance." + cr;
    output += "dailysensordata {source} day {day}" + cr;
    output +=
        "  Prints a table listing all of the sensor data instances for the specified day." + cr;
    output += "power {source} timestamp {timestamp}" + cr;
    output += "  Prints the power generated by the source at the given timestamp." + cr;
    output +=
        "powerstats {source} day {day} sampling-interval {minutes} statistic {max|min|average}"
            + cr;
    output +=
        "  Returns the maximum, minimum, or average power generated by the source for the day."
            + cr;
    output += "total [carbon|energy] {source} day {day} sampling-interval {minutes}" + cr;
    output +=
        "  Returns the total amount of carbon (or energy) emitted by this source for the given"
            + " day." + cr;
    output +=
        "chart power [generated|consumed] {source} {startday} {endday} sampling-interval {minutes} "
            + "file {file}" + cr;
    output +=
        "  Writes out an html file that will display a chart illustrating the power for the "
            + "source over the interval." + cr;
    output += "fueltypes {source}" + cr;
    output += "  Returns a table of fuels associated with this source." + cr;
    output += "totalpower {source} {timestamp} fuelType {fuelType}" + cr;
    output += "  Returns the total power generated by the given fuel type. " + cr;
    output += "carboncontent {source} {timestamp} sampling-interval {interval}" + cr;
    output +=
        "  Returns the total carbon that would be emitted by that source over an hour at the "
            + "rate occurring as of the timestamp. " + cr;
    return output;
  }

}
